export const formatTime = (time: number, format: string) => {
  const date = new Date(time);
  const Y = date.getFullYear();
  const M = date.getMonth() + 1;
  const D = date.getDate();
  const hour = date.getHours();
  const min = date.getMinutes();
  const sec = date.getSeconds();
  if (format === 'd') {
    return (
      Y + '年' + (M < 10 ? '0' + M : M) + '月' + (D < 10 ? '0' + D : D) + '日 '
    );
  } else if (format === 's') {
    return (
      Y +
      '年' +
      (M < 10 ? '0' + M : M) +
      '月' +
      (D < 10 ? '0' + D : D) +
      '日 ' +
      (hour < 10 ? '0' + hour : hour) +
      '时' +
      (min < 10 ? '0' + min : min) +
      '分' +
      (sec < 10 ? '0' + sec : sec) +
      '秒'
    );
  }
};
